#include "UserAllHead.h"

#if STEP_MOTOR_EN
void StepMotorGpioInit(void)
{

}
void StepMotorCrl(void)
{
    static uchar MotorStep01;
    if (Direction)
    {
        if (0 == MotorStep01)
            MotorStep01 = 8;
        MotorStep01--;
    }
    else
    {
        MotorStep01++;
        if (MotorStep01 >= 8)
        {
            MotorStep01 = 0;
        }
    }

    switch (MotorStep01)
    {
    case 0:
        P_MOTOR01_A_IO = 1;
        P_MOTOR01_B_IO = 0;
        P_MOTOR01_C_IO = 0;
        P_MOTOR01_D_IO = 1;
        break;
    case 1:
        P_MOTOR01_A_IO = 1;
        P_MOTOR01_B_IO = 0;
        P_MOTOR01_C_IO = 0;
        P_MOTOR01_D_IO = 0;
        break;
    case 2:
        P_MOTOR01_A_IO = 1;
        P_MOTOR01_B_IO = 1;
        P_MOTOR01_C_IO = 0;
        P_MOTOR01_D_IO = 0;
        break;
    case 3:
        P_MOTOR01_A_IO = 0;
        P_MOTOR01_B_IO = 1;
        P_MOTOR01_C_IO = 0;
        P_MOTOR01_D_IO = 0;
        break;
    case 4:
        P_MOTOR01_A_IO = 0;
        P_MOTOR01_B_IO = 1;
        P_MOTOR01_C_IO = 1;
        P_MOTOR01_D_IO = 0;
        break;
    case 5:
        P_MOTOR01_A_IO = 0;
        P_MOTOR01_B_IO = 0;
        P_MOTOR01_C_IO = 1;
        P_MOTOR01_D_IO = 0;
        break;
    case 6:
        P_MOTOR01_A_IO = 0;
        P_MOTOR01_B_IO = 0;
        P_MOTOR01_C_IO = 1;
        P_MOTOR01_D_IO = 1;
        break;
    case 7:
        P_MOTOR01_A_IO = 0;
        P_MOTOR01_B_IO = 0;
        P_MOTOR01_C_IO = 0;
        P_MOTOR01_D_IO = 1;
        break;
    default:
        break;
    }
}
#endif //STEP_MOTOR_EN
